import 'package:flutter/material.dart';

import '../../../utils/commonUtil.dart';
import '../../../utils/ColorUtil.dart';
import '../../../widgets/common/CommonWidget.dart';
import '../../../widgets/common/LineNav.dart';
import '../../../widgets/common/MiniTitleNav.dart';


class CarResourcesDetail extends StatefulWidget {
  Map arguments;

  CarResourcesDetail({super.key, required this.arguments});

  @override
  State<StatefulWidget> createState() => _CarResourcesDetail();
}

class _CarResourcesDetail extends State<CarResourcesDetail> {

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    print(widget.arguments);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      backgroundColor: Theme.of(context).colorScheme.onPrimary,
      appBar: commonWidget.appBar(
        title: const Text("车辆详情") ,
        leading: GestureDetector(onTap: (){Navigator.pop(context);},child: const Icon(Icons.keyboard_arrow_left),),
      ),
      body:   Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              padding: EdgeInsets.fromLTRB(16, 6, 16, 6),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  ListTile(title: Text(widget.arguments["carName"]),subtitle: Text("锋兰达"),trailing: Icon(Icons.arrow_right_sharp),),
                  LineNav().miniLine(),
                  SizedBox(height: 10,),
                  Row(
                    children: [
                      Text("订单编号：",style: TextStyle(fontSize: 14),),
                      Text("4545454545",style: TextStyle(fontSize: 14,color: Colors.black),)
                    ],
                  ),
                  SizedBox(height: 10,),
                  Row(
                    children: [
                      Text("提交时间：",style: TextStyle(fontSize: 14),),
                      Text("2025-4-23  11:11:20",style: TextStyle(fontSize: 14,color: Colors.black),)
                    ],
                  )
                ],
              ),
            ),
            SizedBox(height: 10,),
            LineNav().heightLine(),
            MiniTitleNav(title: '订单金额', showLine: false,),
            Container(
              padding: EdgeInsets.fromLTRB(16, 0, 16, 6),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('转账后需经过财务确认收款，请耐心等待！',style: TextStyle(color: Colors.red),),
                  SizedBox(height: 10),
                  LineNav().miniLine(),
                  SizedBox(height: 10),
                  const Row(
                    children: [
                      SizedBox(child: Text("订单总额"),width: 90,),
                      Expanded(flex: 4, child: Text("54万"))
                    ],
                  ),
                  SizedBox(height: 10,),
                  LineNav().miniLine(),
                  SizedBox(height: 10,),
                  const Row(
                    children: [
                      SizedBox(child: Text("待支付定金"),width: 90,),
                      Expanded(flex: 4, child: Text("30万"))
                    ],
                  ),
                  SizedBox(height: 10,),
                  const Row(
                    children: [
                      SizedBox(child: Text("待支付尾款"),width: 90,),
                      Expanded(flex: 4, child: Text("30万"))
                    ],
                  ),
                  SizedBox(height: 10,),
                ],
              )
            ),
            LineNav().heightLine(),
            MiniTitleNav(title: '其他', showLine: false,),
            Container(
              padding: EdgeInsets.fromLTRB(16, 6, 16, 6),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  LineNav().miniLine(),
                  SizedBox(height: 10,),
                  Flex(
                    direction: Axis.horizontal,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      const Flexible(flex: 1,child: Text("专属客户")),
                      ElevatedButton.icon(
                        onPressed: (){
                          CommonUtil.launchPhone("100886");
                        },
                        label: Text("专属客服",style: TextStyle(color: Colors.white),),
                        icon: Icon(Icons.wechat,color: Colors.white,),
                        style: ElevatedButton.styleFrom(
                          backgroundColor: ColorUtil.primaryBgColor,
                          elevation: 4
                        ),

                      )

                    ],
                  ),
                ],
              )
            )
          ],
      )
    );
  }

}
